/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.umss.arqui10.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.OneToMany;


/**
 *
 * @author rho1and0
 */
@Entity
@Table(name = "Service")
public class Service extends Billable implements Serializable {

    @Column(name = "name")
    private String name;

    @Column(name = "description")
    private String description;

    /*
     * OutputBean is a goods
     * Integer is a quantity
     */
    @Column(name = "goods")
    @OneToMany
    protected List<OutputBean> goods;

    @Id
    private Long id;

    private boolean usable;

    Service(Long id, String name, String desc) {
        super();
        this.id = id;
        this.name = name;
        this.description = desc;
        this.usable = true;
        this.goods = new LinkedList<OutputBean>();
    }
    
    public Service(Long id, String name, String desc, BigDecimal price) {
        super();
        this.id = id;
        this.name = name;
        this.description = desc;
        this.usable = true;
        this.price.changeCurrentPrice(price);
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }
    
    public List<OutputBean> getGoods() {
        return this.goods;
    }

    public void addOutputBean(OutputBean good) {
        this.goods.add(good);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setUsable(boolean usable) {
        this.usable = usable;
    }

    public boolean isUsable() {
        return this.usable;
    }
}
